<template>
	<view class="achievement">
		<view class="item flex_space_b" @click="goDetails(1)">
			<view class="left">新生办卡</view>
			<view class="right">
				<view class="number">{{count.new_card}}</view>
				<view class="label">有效订单</view>
			</view>
		</view>
		<view class="item flex_space_b" @click="goDetails(2)">
			<view class="left">老生办卡</view>
			<view class="right">
				<view class="number">{{count.old_card}}</view>
				<view class="label">有效订单</view>
			</view>
		</view>
		<view class="item flex_space_b" @click="goDetails(3)">
			<view class="left">充100送100</view>
			<view class="right">
				<view class="number">{{count.one_hundred}}</view>
				<view class="label">有效订单</view>
			</view>
		</view>
		<view class="item flex_space_b" @click="goDetails(5)">
			<view class="left">宽带订单</view>
			<view class="right">
				<view class="number">{{count.kuandai}}</view>
				<view class="label">有效订单</view>
			</view>
		</view>
		<view class="item flex_space_b" @click="goDetails(6)">
			<view class="left">入网订单</view>
			<view class="right">
				<view class="number">{{count.ruwang}}</view>
				<view class="label">有效订单</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	var util = require('../../common/util.js');
	export default {
		data() {
			return {
				j_user_id:'',
				count:[],
				is_me:0,
				click_j_parent_admin_user:0
			}
		},
		onLoad (options) {
			// 当前选择的校区代理
			if(uni.getStorageSync('click_j_parent_admin_user') && uni.getStorageSync('click_j_parent_admin_user') != 0){
				this.click_j_parent_admin_user = uni.getStorageSync('click_j_parent_admin_user')
			}
			if (options.id && options.j_name) {
				this.j_user_id = options.id;
				uni.setNavigationBarTitle({
					title: options.j_name + '的业绩'
				})
			}
			this.is_me = options.is_me;
			this.getCount();
		},
		methods: {
			
			getCount(){
				util.requestPost('user/getOrderCount', {j_user_id:this.j_user_id,is_me:this.is_me,j_parent_admin_user:this.click_j_parent_admin_user}, (res) => {
					if (res.code == 1) {
						this.count = res.data.list
					} else {
						console.log(res);
					}
				}, (err) => {
					console.log(err);
				}, {isShowLoading: false});
			},
			goDetails (type) {
				uni.navigateTo({
					url: `/pages/my/achievementDetails?pageType=${type}&j_user_id=` + this.j_user_id + '&is_me=' + this.is_me
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.achievement {
	padding: 32rpx;
	.item {
		padding: 32rpx;
		box-shadow:  0 0 8rpx rgba($color: #000000, $alpha: 0.2);
		border-radius: 12rpx;
		background-color: #FFFFFF;
		&:not(:last-of-type) {
			margin-bottom: 20rpx;
		}
		.left {
			font-size: 32rpx;
			font-weight: bold;
		}
		.right {
			text-align: center;
			.number {
				font-size: 28rpx;
				font-weight: bold;
			}
			.label {
				font-size: 24rpx;
			}
		}
	}
}
</style>
